"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var local_storage_service_1 = require("../../lib/service/local-storage.service");
var MainSideComponent = /** @class */ (function () {
    function MainSideComponent(router, localStorageService) {
        this.router = router;
        this.localStorageService = localStorageService;
        this.sideType = 'store-product/goods-manage';
        this.goodsManageStatus = true;
        this.distributionMgmtStatus = false;
        this.financeMgmtStatus = false;
        this.userMgmtStatus = false;
        this.isShow = false;
    }
    MainSideComponent.prototype.ngOnInit = function () {
    };
    MainSideComponent.prototype.ngDoCheck = function () {
        if (this.router.url.indexOf('applet-setting') > -1) {
            this.operation = 'setting';
        }
        if (this.router.url.indexOf('store-product') > -1) {
            this.operation = 'management';
        }
        if (this.router.url.indexOf('applet-setting/authorization') > -1) {
            this.sideType = 'applet-setting/authorization';
        }
        if (this.router.url.indexOf('applet-setting/release') > -1) {
            this.sideType = 'applet-setting/release';
        }
        if (this.router.url.indexOf('applet-setting/setting') > -1) {
            this.sideType = 'applet-setting/setting';
        }
        if (this.router.url.indexOf('store-product/goods-manage') > -1) {
            this.sideType = 'store-product/goods-manage';
        }
        if (this.router.url.indexOf('order-manage') > -1) {
            this.sideType = 'store-product/order-manage';
        }
        if (this.router.url.indexOf('delivery-manage') > -1) {
            this.sideType = 'store-product/delivery-manage';
        }
        if (this.router.url.indexOf('temp-manage') > -1) {
            this.sideType = 'store-product/temp-manage';
        }
    };
    MainSideComponent.prototype.changeMenu = function (menu, needChecked) {
        if (!this.localStorageService.getNowApplet()) {
            return;
        }
        else {
            if (needChecked) {
                if (this.localStorageService.getNowApplet().status === '未授权' && !this.localStorageService.getAppletToken()) {
                    this.type = 'info';
                    this.message = '请先完成小程序授权';
                    this.isShow = true;
                    return;
                }
                else {
                    this.sideType = menu;
                    this.router.navigate(['main/' + menu]);
                }
            }
            else {
                this.sideType = menu;
                this.router.navigate(['main/' + menu]);
            }
        }
    };
    MainSideComponent.prototype.openNewPage = function (url) {
        // if (!this.localStorageService.getNowApplet().coupons_key) {
        //   this.type = 'info';
        //   this.message = '请先前往小程序设置，开通卡券功能';
        //   this.isShow = true;
        //   return;
        // }
        window.location.href = url;
    };
    __decorate([
        core_1.Input()
    ], MainSideComponent.prototype, "hasAside", void 0);
    MainSideComponent = __decorate([
        core_1.Component({
            selector: 'app-main-side',
            templateUrl: './main-side.component.html',
            styleUrls: ['./main-side.component.scss'],
            providers: [local_storage_service_1.LocalStorageService]
        })
    ], MainSideComponent);
    return MainSideComponent;
}());
exports.MainSideComponent = MainSideComponent;
